import { lazy, Suspense } from 'react'
import { Router, Route, Switch, Redirect } from 'react-router-dom'
// import Home from 'views/Home'
import history from 'utils/history'
// import Login from 'views/Login'
import AuthRoute from 'components/AuthRoute'
const Login = lazy(() => import('views/Login'))
const Home = lazy(() => import('views/Home'))

function App() {
  return (
    <Router history={history}>
      <div className="App">
        <Suspense fallback={<div>加载中...</div>}>
          <Switch>
            <Redirect exact from="/" to="/home"></Redirect>
            {/* <Route path="/" render={() => <Redirect to="/home" />}></Route> */}
            {/* <Route path="/home" component={Home}></Route> */}
            {/* <Route component={Haa}></Route> */}
            <AuthRoute path="/home" component={Home}></AuthRoute>
            <Route path="/login" component={Login}></Route>
          </Switch>
        </Suspense>
      </div>
    </Router>
  )
}

export default App
